<?php
require_once("../../../include/connect.php");
$uploaddir = '../../../img/slide_images/'; 

$size=$_FILES['uploadfile']['size'];
if($size>2048576)
{
	echo "error file size > 2 MB";
	unlink($_FILES['uploadfile']['tmp_name']);
	exit;
}
else
{
	$url = $_FILES['uploadfile']['name'];
	$query = mysql_query(" INSERT INTO picture(url) VALUES ('$url') ");
	if($query)
	{
		move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploaddir. $_FILES['uploadfile']['name']); 
		echo "success"; 
	}
	else
		echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$uploaddir."($size)";
	
}
?>